package com.fuqi.android.zhongcai.base.view.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;

/**
 * by juner on 2016/8/12.
 */
public abstract class BaseFragment extends Fragment {

    public View baseview;

    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (baseview == null) {
            baseview = inflater.inflate(getLayoutId(), container, false);
        }
        ButterKnife.bind(this, baseview);
        return baseview;
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initView();
        initData();
        initListener();
    }



    public View findViewById(int id){
    	
    	return baseview.findViewById(id);
    }
    
    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }


    public abstract void initView();
    public abstract void initListener();
    public abstract void initData();
    public abstract int getLayoutId();

}
